import React, { Component } from 'react';
import './App.css';

class App extends Component {
  constructor() {
    super();
    this.state = {
      txt: 'this is the state txt',
      cat: '0'
    }
  }
  update(e) {
    this.setState({txt: e.target.value})
  }
  render() {
    return (
    <div>
      <h1>{this.state.txt}</h1>
      <Widget update={this.update.bind(this)} value={this.state.txt}/>
    </div>
    )
  }
}
const Widget = (props) => 
  <input type="text" value={props.value} onChange={props.update}/>

export default App;
